package com.dennis.utils;

import java.util.Random;

public class Utils {
	/**
	 * 
	 * @param 
	 * seed Creates a new random number generator using a single long seed
	 * @param n 
	 * @param count 
	 * @return a random array
	 */
	public static int[] getRandomArray(int seed,int n,int count){
		Random rand = new Random(seed);
		int[] array = new int[count];
		for (int i = 0; i < array.length; i++) {
			array[i] = rand.nextInt(n);
		}
		return array;
	}
	/**
	 * 选择排序法排序,从小到大排序
	 * @param a 需要排序的数组
	 * @return 排序好的数组
	 */
	public static int[] getSortedArrays(int[] a){
		int temp;
		for (int i = 0; i < a.length; i++) {
			int minIndex=i;
			for(int j =minIndex+1; j<a.length; j++){
				if(a[j]<a[minIndex]	){
					temp = a[minIndex];
					a[minIndex] = a[j];
					a[j] = temp;
				}
			}
		}
		return a;
	}
	public static void PrintArray(int[] a){
		for (int i = 0; i < a.length; i++) {
			System.out.println(a[i]);
		}
	}
}
